package com.example.servletdemo.servlet;

import com.alibaba.fastjson.JSON;
import com.example.servletdemo.model.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//@WebServlet(urlPatterns = "/user/test")
public class TestServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //浏览器默认是gb2312，设置编码格式utf-8
        resp.setContentType("text/html;charset=utf-8");
        resp.getOutputStream().write("hello，world,123".getBytes());
    }
}
